package maitaole.controller;

import com.alibaba.fastjson.JSON;
import maitaole.annotion.RequestMapping;
import maitaole.bean.Menu1;
import maitaole.result.ResultNew;
import maitaole.service.impl.MenuListImpl;

import javax.servlet.annotation.WebServlet;
import java.util.List;

/**
 * @Author 李杰
 * @Description 类的功能描述
 * @Date 2023/5/16
 */
@WebServlet("/MenuController/*")
public class MenuController extends BaseServlet{

    MenuListImpl menuList = new MenuListImpl();
    ResultNew resultNew = new ResultNew();
    @RequestMapping("/listMenus")
    public String listMenus(){
        List<Menu1> menu1s = menuList.listAllMenus();
        if(menu1s!=null){
            ResultNew sccuess = resultNew.sccuess(menu1s);
            return JSON.toJSONString(sccuess);
        }else {
            ResultNew fail = resultNew.fail();
            return JSON.toJSONString(fail);
        }
    }

    public static void main(String[] args) {

    }

}

